import {request, uploadFile} from './bks.request'

export const applet = (data) => request({
  url: '/oauth/applet',
  method: 'post',
  header: {
   client_id: 'applet',
   client_secret: '123456'
  },
  data,
  loading: '登录中...'
})
export const appletOpenId = (data) => request({
  url: '/oauth/applet/openId',
  method: 'post',
  data
})
export const appletPhone = (data) => request({
  url: '/oauth/applet/phone',
  method: 'post',
  data
})
export const getVersion = () => request({
  url: '/sys/sysVersion/applet-anon/select',
  method: 'get',
  params:{versionType: 1}
})
export const getCodeState = (params) => {
  return request({
    url: '/web/web-anon/scan/success',
    method: 'get',
    params
  })
}
export const getWebLogin = (data) => {
  return request({
    url: '/oauth/web',
    method: 'post',
    header: {
     client_id: 'applet',
     client_secret: '123456'
    },
    data,
    loading: '登录中...'
  })
}
export const getCode = (params) => request({
  url: '/notify/sms',
  method: 'get',
  params
})
export const bindMobile = (data) => request({
  url: '/applet/member/applet-anon/member/mobile/set',
  method: 'post',
  data
})

export const bindSetMobile = (data) => request({
    url: '/applet/member/mobile/set',
    method: 'post',
    data
  })
export const bindNewMobile = (data) => request({
  url: '/applet/member/applet-anon/member/mobile/confirm',
  method: 'post',
  data
})
export const mobileLogin = (data) => request({
  url: '/oauth/app/smscode/login',
  method: 'post',
  header: {
   client_id: 'applet', // app
   client_secret: '123456'
  },
  params: data,
  loading: '登录中...'
})
export const bannerStatistical = async(params) => await request({
  url: '/applet/applet-anon/ad/count',
  method: 'get',
  params
})
